# Top Makefile for c program
# Top Makefile for c program
CC 			:= $(CROSS_COMPILE)gcc
GG			:= $(CROSS_COMPILE)g++

# -Wall 打开所有警告
# Werror 把所有警告当作错误处理

CFLAGS 		+= -g -Wall -Werror -O2

INC		 	:= -I ../main/inc 
INC		 	+= -I ../testA/inc 
INC		 	+= -I ../testB/inc 

SRCS_FIELS 	= $(wildcard src/*.cpp)
SRC_OBJS	= $(patsubst %.cpp, %.o, $(SRCS_FIELS))
SRC_LIB		= testA.a

all:$(SRC_LIB)

$(SRC_LIB) : $(SRC_OBJS)
	$(AR) rcs $@ $^
	cp $@ ../libs

$(SRC_OBJS): %.o : %.cpp
	$(GG) $(CFLAGS) -c -o $@ $< $(INC)

clean:
	$(RM) $(SRC_OBJS) $(SRC_BIN)

distclean:
	$(RM) $(SRC_OBJS) $(SRC_BIN)
	